﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using PowerfulExtensions.ClassMembers;
using PowerfulExtensions.Test;

namespace PowerExtensions.Test
{
    [TestFixture]
    class MemberHelperTest
    {
        [Test]
        public void Should_ReturnProperPropertyAndFildName_ByType()
        {
            var propName = MemberHelper.GetName<MyClass>(c => c.IntProp);
            Assert.AreEqual("IntProp", propName);
            var fieldName = MemberHelper.GetName<MyClass>(c => c.FloatField);
            Assert.AreEqual("FloatField", fieldName);
        }

        [Test]
        public void Should_ReturnProperPropertyAndFildName_ByObject()
        {
            var obj = new MyClass();
            var propName = MemberHelper.GetName(() => obj.IntProp);
            Assert.AreEqual("IntProp", propName);
            var fieldName = MemberHelper.GetName(() => obj.FloatField);
            Assert.AreEqual("FloatField", fieldName);
        }
    }
}
